/**
 * <copyright>
 * </copyright>
 *
 */
package de.sabram.upb.specs.lido.impl;

import de.sabram.upb.specs.lido.Attr;
import de.sabram.upb.specs.lido.AttrUseId;
import de.sabram.upb.specs.lido.LidoPackage;
import de.sabram.upb.specs.lido.SymOcc;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Attr</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.sabram.upb.specs.lido.impl.AttrImpl#getSymOcc <em>Sym Occ</em>}</li>
 *   <li>{@link de.sabram.upb.specs.lido.impl.AttrImpl#getAttrUseId <em>Attr Use Id</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class AttrImpl extends DefAttrImpl implements Attr
{
  /**
   * The cached value of the '{@link #getSymOcc() <em>Sym Occ</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSymOcc()
   * @generated
   * @ordered
   */
  protected SymOcc symOcc;

  /**
   * The cached value of the '{@link #getAttrUseId() <em>Attr Use Id</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAttrUseId()
   * @generated
   * @ordered
   */
  protected AttrUseId attrUseId;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected AttrImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return LidoPackage.Literals.ATTR;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public SymOcc getSymOcc()
  {
    return symOcc;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetSymOcc(SymOcc newSymOcc, NotificationChain msgs)
  {
    SymOcc oldSymOcc = symOcc;
    symOcc = newSymOcc;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LidoPackage.ATTR__SYM_OCC, oldSymOcc, newSymOcc);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setSymOcc(SymOcc newSymOcc)
  {
    if (newSymOcc != symOcc)
    {
      NotificationChain msgs = null;
      if (symOcc != null)
        msgs = ((InternalEObject)symOcc).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LidoPackage.ATTR__SYM_OCC, null, msgs);
      if (newSymOcc != null)
        msgs = ((InternalEObject)newSymOcc).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LidoPackage.ATTR__SYM_OCC, null, msgs);
      msgs = basicSetSymOcc(newSymOcc, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, LidoPackage.ATTR__SYM_OCC, newSymOcc, newSymOcc));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public AttrUseId getAttrUseId()
  {
    return attrUseId;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetAttrUseId(AttrUseId newAttrUseId, NotificationChain msgs)
  {
    AttrUseId oldAttrUseId = attrUseId;
    attrUseId = newAttrUseId;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LidoPackage.ATTR__ATTR_USE_ID, oldAttrUseId, newAttrUseId);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setAttrUseId(AttrUseId newAttrUseId)
  {
    if (newAttrUseId != attrUseId)
    {
      NotificationChain msgs = null;
      if (attrUseId != null)
        msgs = ((InternalEObject)attrUseId).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LidoPackage.ATTR__ATTR_USE_ID, null, msgs);
      if (newAttrUseId != null)
        msgs = ((InternalEObject)newAttrUseId).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LidoPackage.ATTR__ATTR_USE_ID, null, msgs);
      msgs = basicSetAttrUseId(newAttrUseId, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, LidoPackage.ATTR__ATTR_USE_ID, newAttrUseId, newAttrUseId));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case LidoPackage.ATTR__SYM_OCC:
        return basicSetSymOcc(null, msgs);
      case LidoPackage.ATTR__ATTR_USE_ID:
        return basicSetAttrUseId(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case LidoPackage.ATTR__SYM_OCC:
        return getSymOcc();
      case LidoPackage.ATTR__ATTR_USE_ID:
        return getAttrUseId();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case LidoPackage.ATTR__SYM_OCC:
        setSymOcc((SymOcc)newValue);
        return;
      case LidoPackage.ATTR__ATTR_USE_ID:
        setAttrUseId((AttrUseId)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case LidoPackage.ATTR__SYM_OCC:
        setSymOcc((SymOcc)null);
        return;
      case LidoPackage.ATTR__ATTR_USE_ID:
        setAttrUseId((AttrUseId)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case LidoPackage.ATTR__SYM_OCC:
        return symOcc != null;
      case LidoPackage.ATTR__ATTR_USE_ID:
        return attrUseId != null;
    }
    return super.eIsSet(featureID);
  }

} //AttrImpl
